package gemini.basic.model;

// Generated Apr 8, 2011 7:19:01 AM by Hibernate Tools 3.4.0.Beta1

import static javax.persistence.GenerationType.IDENTITY;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;

/**
 * GBill generated by hbm2java
 */
@Entity
@Table(name = "g_bill")
public class Bill extends AbstractDomain {

	private static final long serialVersionUID = 1L;
	
	private Integer id;
	private Integer version;
	private Address addressByShippingAddressId;
	private Payment payment;
	private Address addressByBillingAddressId;
	private String purchasedBy;
	private Date processingDate;
	private String distributorCode;
	private short discountScaleValue;
	private List<BillDetail> billDetails = new ArrayList<BillDetail>(0);

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Version
	@Column(name = "version")
	public Integer getVersion() {
		return this.version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "shipping_address_id", nullable = false)
	public Address getAddressByShippingAddressId() {
		return this.addressByShippingAddressId;
	}

	public void setAddressByShippingAddressId(
			Address addressByShippingAddressId) {
		this.addressByShippingAddressId = addressByShippingAddressId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "payment_id")
	public Payment getPayment() {
		return this.payment;
	}

	public void setPayment(Payment payment) {
		this.payment = payment;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "billing_address_id", nullable = false)
	public Address getAddressByBillingAddressId() {
		return this.addressByBillingAddressId;
	}

	public void setAddressByBillingAddressId(
			Address addressByBillingAddressId) {
		this.addressByBillingAddressId = addressByBillingAddressId;
	}

	@Column(name = "purchased_by", nullable = false, length = 50)
	public String getPurchasedBy() {
		return this.purchasedBy;
	}

	public void setPurchasedBy(String purchasedBy) {
		this.purchasedBy = purchasedBy;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "processing_date", nullable = false, length = 10)
	public Date getProcessingDate() {
		return this.processingDate;
	}

	public void setProcessingDate(Date processingDate) {
		this.processingDate = processingDate;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "bill")
	public List<BillDetail> getBillDetails() {
		return this.billDetails;
	}

	public void setBillDetails(List<BillDetail> billDetails) {
		this.billDetails = billDetails;
	}

	@Column(name = "distributor_code", nullable = false, length = 20)
	public String getDistributorCode() {
		return this.distributorCode;
	}

	public void setDistributorCode(String distributorCode) {
		this.distributorCode = distributorCode;
	}
	
	@Column(name = "discount_scale_value", nullable = false)
	public short getDiscountScaleValue() {
		return this.discountScaleValue;
	}

	public void setDiscountScaleValue(short discountScaleValue) {
		this.discountScaleValue = discountScaleValue;
	}
}
